﻿Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim einKonto As Konto
        einKonto = New Konto
        'einKonto.Kontonummer = "1000"
        'einKonto.Kontoinhaber = "David Dröge"
        'einKonto.Kontostand = 43.34D

        TextBox1.Text = "Der Textboxinhalt"

        Dim KontoZwei As Konto
        KontoZwei = einKonto
        'KontoZwei.Kontoinhaber = "Zoe Dröge"

        KontoZwei.TelefonGeheimzahl = "1234"
        MessageBox.Show(einKonto.TelefonGeheimzahl)


    End Sub
End Class

Public Class Konto
    Private myKontonummer As String
    Private myKontoinhaber As String
    Private myKontostand As Decimal
    Private myTelefonGeheimzahl As String

    Public Property TelefonGeheimzahl() As String
        Get
            Return myTelefonGeheimzahl
        End Get
        Set(ByVal value As String)
            If value.Length <> 4 Then Return
            myTelefonGeheimzahl = value
        End Set
    End Property

    Public ReadOnly Property Kontostand() As Decimal
        Get
            Return myKontostand
        End Get
    End Property

    Public Sub Einzahlen(ByVal Betrag As Decimal)
        myKontostand += Betrag
    End Sub
End Class